/**********************************************************************************************/
/* FBL_EnumToString.cpp                                                          			  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006															  */
/* All Rights Reserved.                                                 					  */
/**********************************************************************************************/

#include <VShared/FBL/publ/Headers/StdAfx.h>

#include <VShared/FBL/publ/Util_Strings/FBL_EnumToString.h>

#include <VShared/FBL/publ/Headers/FBL.h>


/**********************************************************************************************/
FBL_Begin_Namespace


/**********************************************************************************************/
const char* DatabaseMode2String( DbMode inMode )
{
	switch( inMode )
	{
		case kDscDatBlbInd:
			return "kDscDatBlbInd";
		case kDsc_DatBlbInd:
			return "kDsc_DatBlbInd";
		case kDsc_DatBlb_Ind:
			return "kDsc_DatBlb_Ind";
		case kDsc_Dat_Blb_Ind:
			return "kDsc_Dat_Blb_Ind";
		case kDscDatBlb_Ind:
			return "kDscDatBlb_Ind";
		case kDscDat_Blb_Ind:
			return "kDscDat_Blb_Ind";
		case kDscDatInd_Blb:
			return "kDscDatInd_Blb";
		case kDsc_DatInd_Blb:
			return "kDsc_DatInd_Blb";
		default:
			return NULL;
	};
}


/**********************************************************************************************/
const char* DateFormat2String( EDateFormat inDateFormat )
{
	switch( inDateFormat )
	{
		case kMDY:
			return "kMDY";
		case kDMY:
			return "kDMY";
		case kYMD:
			return "kYMD";
		default:
			return NULL;
	};
}


/**********************************************************************************************/
const char* ColAttribValue2String( UColAttributeValue inValue )
{
	switch( inValue )
	{
		case UCOL_DEFAULT:
			return "kDefault";
		case UCOL_PRIMARY:
			return "kPrimary";
		case UCOL_SECONDARY:
			return "kSecondary";
		case UCOL_TERTIARY:
			return "kTertiary";
		case UCOL_QUATERNARY:
			return "kQuaternary";
		case UCOL_IDENTICAL:
			return "kIdentical";
		case UCOL_OFF:
			return "kOff";
		case UCOL_ON:
			return "kOn";
		case UCOL_SHIFTED:
			return "kShifted";
		case UCOL_NON_IGNORABLE:
			return "kNonIgnorable";
		case UCOL_LOWER_FIRST:
			return "kLowerFirst";
		case UCOL_UPPER_FIRST:
			return "kUpperFirst";
		default:
			return NULL;
	};
}


#pragma mark - 


/**********************************************************************************************/
DbMode String2DatabaseMode( const char* inStr )
{
	if( inStr == 0 )
		return DbMode(-1);

	// We cannot optimize here...
	if( stricmp(inStr, "kDscDatBlbInd") == 0 )
		return kDscDatBlbInd;
	else if( stricmp(inStr, "kDsc_DatBlbInd") == 0 )
		return kDsc_DatBlbInd;
	else if( stricmp(inStr, "kDsc_DatBlb_Ind") == 0 )
		return kDsc_DatBlb_Ind;
	else if( stricmp(inStr, "kDsc_Dat_Blb_Ind") == 0 )
		return kDsc_Dat_Blb_Ind;
	else if( stricmp(inStr, "kDscDatBlb_Ind") == 0 )
		return kDscDatBlb_Ind;
	else if( stricmp(inStr, "kDscDat_Blb_Ind") == 0 )
		return kDscDat_Blb_Ind;
	else if( stricmp(inStr, "kDscDatInd_Blb") == 0 )
		return kDscDatInd_Blb;
	else if( stricmp(inStr, "kDsc_DatInd_Blb") == 0 )
		return kDsc_DatInd_Blb;

	return DbMode(-1);
}


/**********************************************************************************************/
EDateFormat String2DateFormat( const char* inStr )
{
	if( inStr == 0 )
		return EDateFormat(-1);

	// We cannot optimize here...
	if( stricmp(inStr, "kMDY") == 0 )
		return kMDY;
	else if( stricmp(inStr, "kDMY") == 0 )
		return kDMY;
	else if( stricmp(inStr, "kYMD") == 0 )
		return kYMD;

	return EDateFormat(-1);
}


/**********************************************************************************************/
UColAttributeValue String2ColAttribValue( const char* inStr )
{
	if( inStr == 0 )
		return UColAttributeValue(-1);

	// We cannot optimize here...
	if( stricmp(inStr, "kDefault") == 0 )
		return UCOL_DEFAULT;
	else if( stricmp(inStr, "kPrimary") == 0 )
		return UCOL_PRIMARY;
	else if( stricmp(inStr, "kSecondary") == 0 )
		return UCOL_SECONDARY;
	else if( stricmp(inStr, "kTertiary") == 0 )
		return UCOL_TERTIARY;
	else if( stricmp(inStr, "kQuaternary") == 0 )
		return UCOL_QUATERNARY;
	else if( stricmp(inStr, "kIdentical") == 0 )
		return UCOL_IDENTICAL;
	else if( stricmp(inStr, "kOff") == 0 )
		return UCOL_OFF;
	else if( stricmp(inStr, "kOn") == 0 )
		return UCOL_ON;
	else if( stricmp(inStr, "kShifted") == 0 )
		return UCOL_SHIFTED;
	else if( stricmp(inStr, "kNonIgnorable") == 0 )
		return UCOL_NON_IGNORABLE;
	else if( stricmp(inStr, "kLowerFirst") == 0 )
		return UCOL_LOWER_FIRST;
	else if( stricmp(inStr, "kUpperFirst") == 0 )
		return UCOL_UPPER_FIRST;

	return UColAttributeValue(-1);
}


/**********************************************************************************************/
FBL_End_Namespace














